/**
 * By Stefan
 * 
 * 
 * Changelog:
 * By Philip: Wird abhängig von Spielerposition gespawnt
 *
 * 
 **/

using UnityEngine;
using System.Collections;

public class SpawnScript : MonoBehaviour {

	private int pastSec = 0;						/* Vergangene Zeit */


	// Use this for initialization
	void Start ()
	{

	}
	
	// Update is called once per frame
	void Update () {
	
		if (pastSec > 300) 			/* Ist eine Sekunden vergangen? Dann spawne Objekt! */
		{
			GameObject myEl = (GameObject)Instantiate(GameObject.FindGameObjectWithTag("Enemy"),(GameObject.Find("Player").transform.position) + new Vector3(Random.Range(20,100),1,Random.Range(20,100)),Quaternion.Euler(0,0,0));
			//myEl.transform.position = (GameObject.Find("Player").transform.position) + new Vector3(Random.Range(20,100),1,Random.Range(20,100));
			//cube.AddComponent<Rigidbody>().useGravity = true;
			//cube.AddComponent<ZombieAI>();


			pastSec = 0;
		}

		pastSec++;
	}
}
